package com.situ.day2;

import org.junit.Test;

import javax.swing.text.rtf.RTFEditorKit;
import java.util.Scanner;

public class IfElseDemo {
//    >=90   <=100      优秀
//    >=80    <90       良好
//    >=70    <80       一般
//    >=60    <70      及格
//    <60               及格
    @Test
    public void test1() {
        // utf-8
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入成绩：");
        int score = scanner.nextInt();
        //int score = 98;
        if (score >= 90 && score <= 100) {
            System.out.println("优秀");
        } else if (score >= 80 && score < 90) {
            System.out.println("良好");
        } else if (score >= 70 && score < 80) {
            System.out.println("一般");
        } else if (score >= 60 && score < 70) {
            System.out.println("及格");
        } else { // 默认情况
            System.out.println("不及格");
        }
    }

    @Test
    public void test56() {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入成绩1：");
        int score1 = scanner.nextInt();
        System.out.println(score1);
        System.out.println("请输入成绩2");
        int score2 = scanner.nextInt();
        System.out.println(score2);

    }

    //三目运算符号：
    //语法：boolean ? 数1 ： 数2
    @Test
    public void test67() {
        int num1 = 13;
        int num2 = 5;
        int result = 0;
        if (num1 >= num2) {
            result = num1;
        } else {
            result = num2;
        }
        System.out.println(result);
    }

    @Test
    public void test68() {
        int num1 = 13;
        int num2 = 5;
        int result = num1 >= num2 ? num1 : num2;
        System.out.println(result);
    }

    //+号运算符：
    //1、两边都是数字，则做的就是加法运算
    //2、若一边为字符串，则做的是字符串的拼接
    @Test
    public void test89() {
        int num1 = 3;
        int num2 = 5;
        int result = num1 + num2;
        System.out.println(num1 + num2);
        System.out.println(3 + 6);

        //字符串：双引号括起来
        System.out.println("你好count");
        System.out.println("num1:" + num1);
        // "num1:3+num2:5=8"   豆豆加加
        //System.out.println("num1:3+num2:5=8");
        //有点难度
        System.out.println("num1:" + num1 + "+num2:" + num2 + "=" + result);
    }
}
